package com.zw.goodsservice.controller;

import com.zw.goodsservice.entity.GoodsInfo;
import com.zw.goodsservice.service.GoodsInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/goods")
@RequiredArgsConstructor
public class GoodsInfoController {
    private final GoodsInfoService goodsInfoService;

    @GetMapping("{id}")
    public GoodsInfo getGoodsInfoById(@PathVariable("id") String id) {
        return goodsInfoService.getGoodsInfoById(id);
    }


    @PostMapping("/add")
    public ResponseEntity<String> addGoodsInfo(@RequestBody GoodsInfo goodsInfo){
        goodsInfoService.addGoodsInfo(goodsInfo);
        return ResponseEntity.ok("添加成功");
    }
}
